<div class="b4"></div>
<dl class="ktab">
    <dt id="tab-music-1">搜索</dt>
    <dd>
<div id="wrp-music-search" style="padding: 30px;padding-top:50px;">
	
	<form id="frm-topic-search" action="<?php echo site_url('c=topic&m=search');?>"
		submitbefor="frm_topic_befor"
		submitafter="frm_topic_after"
		datatype="html"
		onsubmit="return false;"
	>
	<input id="pagenum" type="hidden" name="pagenum" value="1"/>
	<table class="tbl-frm-1" cellpadding="0" cellspacing="0">
		<tr>
			<td class="c3" width="150">歌曲名、专辑名、艺人名：</td>
			<td>
				<input id="kws" class="inp" name="kws" />
			</td>
		<tr/>
	</table>
	</form>
	
	<form id="frm-topic-search-hidden" action="<?php echo site_url('c=topic&m=search');?>"
		submitbefor="frm_topic_befor"
		submitafter="frm_topic_after"
		datatype="html"
		onsubmit="return false;"
	>
    	<input id="pagenum-hidden" type="hidden" name="pagenum" value="1"/>
		<input id="kws-hidden" type="hidden" class="inp" name="kws" />
    	<input id="btn-music-search-hidden" class="btn-s btn-ajax-submit" style="display: none;" 
    		frmid="frm-topic-search-hidden" type="button" value="搜 索" />
	</form>
	
	<div>
    	<input id="btn-music-search" class="btn-s btn-ajax-submit" 
    		frmid="frm-topic-search" type="button" value="搜 索" />
	</div>
	
</div>
    </dd>
    <dt id="tab-music-2">选择</dt>
    <dd>

<div id="wrp-music-rs" style="padding:5px;">
    <div id="c-rs"></div>
	<div>
    	<input id="btn-music-confirm" class="btn-s" type="button" value="确 定" />
	</div>
</div>

    </dd>
    <dt id="tab-music-3">保存</dt>
    <dd>
<div id="wrp-music-save" style="padding: 20px;padding-top:60px;">
	分享音乐:<span id="tip-music-name"></span>
	<form id="frm-music-post" action="<?php echo site_url('c=topic&m=post_do');?>"
		submitbefor="music_post_befor"
		onsubmit="return false;"
	>
	<input type="hidden" id="hdn-post-music-id" name="music_id" value="0"/>
	<input type="hidden" id="hdn-post-music-type" name="music_type" value="1"/>
	<input type="hidden" id="hdn-post-music-name" name="music_name"/>
	
	<input type="hidden" name="recmd" value="<?php echo fd('recmd');?>"/>
	<input type="hidden" name="reason_id" value="<?php echo fd('reason_id','i');?>"/>
	<input type="hidden" name="to_id" value="<?php echo fd('to_id','i');?>"/>
	
	<table class="tbl-frm-1">
		<tr>
			<td>
				<input id="cont-topic" class="inp" name="cont" style="width: 450px;"/>
			</td>
		<tr/>
	</table>
	</form>
	
	<div>
    	<input id="btn-music-post" class="btn-s btn-ajax-submit" 
    		frmid="frm-music-post" type="button" value="保 存" />
	</div>
	
</div>    </dd>
</dl>




     
<script type="text/javascript">
$().ready(function() {
    $(".ktab").KandyTabs({
    	trigger : 'click'
    });	

    $('#btn-music-confirm').click(function(){

        var music_id = $('.rad-music-slt:checked').val();

        if((typeof music_id) == 'undefined'){
        	asyncbox.tips('请选择音乐！','error');
        	return;
        }

        var music_type = $('#hdn-music-type').val();
        var music_name = $('.rad-music-slt:checked').attr('music_name');
        $('#hdn-post-music-id').val(music_id);
        $('#hdn-post-music-name').val(music_name);
        $('#tip-music-name').html('').html(music_name);
        $('#hdn-post-music-type').val(music_type);

        $('#tab-music-3').click();
        
        $('#cont-topic').val('');
        
    });

    $('.asyncbox_close').click(function(){
    	$('#music-media').remove();
    });

	$('#frm-topic-search').keyup(function(e){
		if(e.which == 13){
			$('#btn-music-search').click();
			return false;
		}
	});

	$('#frm-music-post').keyup(function(e){
		if(e.which == 13){
			$('#btn-music-post').click();
			return false;
		}
	});
    
	ajaxinit();
    
}); 
</script>

<script>

function music_post_befor($frm){
	var music_id = $('#hdn-post-music-id').val();
	if(music_id == '0'){
		asyncbox.tips('没有可发表的音乐！','error');
		return false;
	}

	return true;
}


function frm_topic_befor($frm){
	var kws = $('#kws').val();
	if(kws.length == 0){
		asyncbox.tips('请输入关键字！','error');
		$('#kws').focus();
		return false;
	}
	$('#kws-hidden').val(kws);
	
	return true;
}

function frm_topic_after(msg,$frm){
	$('#c-rs').html('').html(msg);
	$('#tab-music-2').click();
	return false;
}
</script>

